#!/usr/bin/ruby

#require File.dirname(__FILE__) + "/../shared.rb"
require 'pp'

def print_confirm(entry_list)
    entry_list.sort! {|x,y| x[START_T_DB_IDX].to_i <=> y[START_T_DB_IDX].to_i}
    list_html = entry_list.map do |x|
        start_t_i = x[START_T_DB_IDX].to_i
        start_t = Time.at(start_t_i)
        end_t = start_t + x[DUR_DB_IDX].to_i

        dur = s2hms( x[DUR_DB_IDX].to_i )
        chat_len = s2hms( x[CHAT_LEN_DB_IDX].to_i )

        desc = "start: #{start_t}; duration: #{dur}; \
            chat length: #{chat_len}"
        "<input type=\"checkbox\" name=\"confirmed\" checked=\"yes\" \
            value=\"#{start_t_i}\" />  #{desc} <br/>"
    end.join("\n")

    puts HTML_HEAD + \
    "<p> 
    We will stitch together the following files. Press \"submit\" to confirm.
    </p>
    <form>
    #{list_html}
    <input type=\"submit\" value=\"Submit\" />
    </form>" + HTML_END

end
